<template>
    <div>
        <van-nav-bar title="设置" left-text="返回" left-arrow @click-left="onClickLeft"/>
        <van-cell title="修改昵称" is-link @click="nameshow = true"/>
        <van-dialog v-model="nameshow" title="修改昵称" show-cancel-button @confirm="handleEditname">
            <input type="text" v-model="nickname" style="border: 1px solid #DEDEDE;margin: 60px;height: 30px;border-radius: 5px;padding-left:10px ;">
        </van-dialog>
        <van-cell title="修改密码" is-link  @click="pwdshow = true"/>
        <van-dialog v-model="pwdshow" title="修改密码" show-cancel-button @confirm="handleEditpwd">
            <input type="text" v-model="password" style="border: 1px solid #DEDEDE;margin: 60px;height: 30px;border-radius: 5px;padding-left:10px ;">
        </van-dialog>
    </div>
</template>
<script>
import {eidtinfo} from "@/api/set"
export default {
   data() {
      return {
        nameshow:false,
        pwdshow:false,
        nickname:"",
        password:""
      }
   },
   created(){
   },
   computed:{
   },
   methods:{
    onClickLeft(){
        this.$router.go(-1)
    },
    handleEditname(){
        eidtinfo({nickname:this.nickname}).then(res=>{
            this.$toast(res.data.msg)
            if(res.data.code == 1){
                this.$toast.success("修改成功")
            }
        })
    },
    handleEditpwd(){
        eidtinfo({password:this.password}).then(res=>{
            this.$toast(res.data.msg)
            if(res.data.code == 1){
                this.$toast.success("修改成功")
            }
        })
    }
   },
}
</script>
<style scoped>

</style>
